<?php /*a:1:{s:67:"D:\phpStudy\WWW\tp5\application\admin\view\admin_tool\tool_add.html";i:1557460545;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-body" style="padding: 20px;">
    <form  class="layui-form" action="">
        <div class="layui-form-item">
            <label for="" class="layui-form-label">器具名称</label>
            <div class="layui-input-block">
                <input type="text" id="name" name="name" class="layui-input" placeholder="请输入器具名称">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="" class="layui-form-label">最大借出天</label>
            <div class="layui-input-inline">
                <input type="text" id="num" name="num"  class="layui-input" placeholder="请输入最大借出天">
            </div>
            <div class="layui-form-mid">
                只可以输入数字
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">器具类型</label>
            <div class="layui-input-block">
                <input type="radio" name="type" value="0" title="小型器具" checked>
                <input type="radio" name="type" value="1" title="大型器具">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">所属教室</label>
            <div class="layui-input-inline">
                <select lay-verify="required" name="lab_id" id="lab_id">
                    <option value="" id="null"></option>
                    <?php if(is_array($labs) || $labs instanceof \think\Collection || $labs instanceof \think\Paginator): $i = 0; $__LIST__ = $labs;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$lab): $mod = ($i % 2 );++$i;?>
                    <option value="<?php echo htmlentities($lab['id']); ?>"><?php echo htmlentities($lab['name']); ?></option>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" type="button" onclick="fuck()">添加器具</button>
            </div>
        </div>
    </form>
</div>

<script>
    function fuck() {
        $.ajax({
            url:"",
            type:"post",
            data:$('form').serialize(),
            dataType:'json',
            success:function (data) {
                if (data.statu==200){
                    layer.msg(data.msg);
                    $('#name').val("");
                    $('#num').val("");
                } else {
                    layer.msg(data.msg);
                }
            }
        })
    }
</script>
</body>
</html>